package com.oneguy.control.message;

import com.oneguy.Constants;
import com.oneguy.model.WeixinMessage;
import com.oneguy.control.timer.TaskManager;
import org.springframework.core.env.Environment;

/**
 * Created by ZuoShu on 16/12/6.
 */
public class MessageHandler {
    Environment ev;
    TextHandler textHandler;

    public MessageHandler(Environment ev, TaskManager taskManager) {
        this.ev = ev;
        textHandler = new TextHandler(ev);
        textHandler.setTaskManager(taskManager);
    }

    public TextHandler getTextHandler() {
        return textHandler;
    }

    public String handleMessage(WeixinMessage message) {
        if (Constants.T.TEXT.equals(message.getMsgType())) {
            return textHandler.handleMessage(message);
        }
        return "";
    }
}
